package com.srlg.liteflow.controller;

import com.yomahub.liteflow.core.FlowExecutor;
import com.yomahub.liteflow.flow.LiteflowResponse;
import jakarta.annotation.Resource;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @desc: 组件
 * @author: srlg li
 * @date: 2025/4/20 下午11:25
 */
@RestController
@RequiredArgsConstructor
@Slf4j
public class ComponentController {

    @Resource
    private FlowExecutor flowExecutor;

    @GetMapping("flow")
    public String testConfig() {
        LiteflowResponse res = flowExecutor.execute2Resp("chain", "arg");
        log.info("result : {}", res.isSuccess());
        return "success";
    }
}
